package opera1;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOPeration {
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入你要查找图书的名字:");
        Scanner input = new Scanner(System.in);
        String bookName = input.nextLine();
        int currentUsedSize = bookList.getUsedSize();
        for (int i = 0; i < currentUsedSize ; i++) {
            Book book = bookList.getBook(i);
            if (bookName.equals(book.getName())) {
                System.out.println("找到了");
                System.out.println(book);
            }
        }
        System.out.println("没有这本书!");
    }
}
